Firmware security key upgrade algorithm

ABSTRACT

A portion of a firmware program may be automatically upgraded during power on of a processor-based system. A firmware upgrade file signed by a private key is authenticated using a public key accessible to the firmware program. The authentication and upgrade is performed automatically. Interrupted upgrades are anticipated and resolved by the firmware program. The public key is duplicated and is itself upgradable, in case the private key changes. The firmware program may be locked to prevent both viewing and unauthorized upgrades of the public keys or other parts of the firmware program.

BACKGROUND

[0001] This invention relates to firmware for a processor-based system, and more particularly, to a secure mechanism for performing firmware upgrades.

[0002] A processor-based system typically includes firmware for initializing the system. Firmware is a software program that is permanently or semi-permanently resident in the processor-based system. Usually, the software program is “burned” into a read-only memory (ROM) or a flash memory device. The ROM or flash devices may be removable integrated circuits (ICs) that plug into a dedicated chip slot in the system board.

[0003] Although the device storing the firmware may be removable and, thus, physically replaced, more typically, the device is re-programmed in place, e.g., without physical removal. ROMs may be programmable (PROMs), erasable (EPROMs), and electrically erasable (EEPROMs). Flash memory is also programmable, and may typically be programmed at a faster rate than EEPROMs.

[0004] Like other software, the firmware itself is a valuable component of the processor-based system. Firmware is the very first code executed in the system. The firmware initializes the key hardware components. Once the system is initialized, the firmware typically loads an operating system program into memory, then executes the program.

[0005] The firmware comprises part of the identity of the processor-based system. Many computer manufacturers, for example, include a proprietary firmware that includes distinct features and capabilities that may distinguish the processor-based system from those of other manufacturers.

[0006] Occasionally, an upgrade to the firmware is desired. However, because the firmware is used to power on the system, firmware upgrades typically take into account the possibility of power failure during the upgrade. For example, many systems divide the firmware up such that only portions of the firmware may be upgraded. Under such protocol, assurance is made that, despite interruption in the firmware upgrade, a minimum amount of firmware is available to power on the system.

[0007] Although the programmability of the ROM/flash devices facilitates firmware upgrade, this capability also may adversely affect the security of the processor-based system. A software program running on the processor-based system, for example, may surreptitiously unlock and reprogram a flash device on the system, thereafter changing the operation of the system, or, worse yet, rendering the system unbootable. Nevertheless, the ability to upgrade and replace the firmware, such as during repairs, is desirable.

[0008] Thus, there is a continuing need to upgrade firmware without adversely affecting the system's security.

BRIEF DESCRIPTION OF THE DRAWINGS

[0009]FIG. 1 is a block diagram of a processor-based system according to one embodiment of the invention;

[0010]FIG. 2 is a block diagram of the firmware of the processor-based system of FIG. 1 according to one embodiment of the invention;

[0011]FIG. 3 is a flow diagram illustrating operation of the firmware of FIG. 2 according to one embodiment of the invention; and

[0012]FIG. 4 is a flow diagram illustrating rewrite of the system firmware of FIG. 2 according to one embodiment of the invention.

DETAILED DESCRIPTION

[0013] According to one embodiment, as illustrated in FIG. 1, a system 100 may securely perform firmware upgrades, as described below. The system 100 includes firmware 200, residing on a flash memory 40. Alternatively, the system 100 may employ read-only memory (ROM) that is programmable, such as electrically erasable programmable read-only memory (EEPROM). The firmware 200 may essentially reside in any programmable, erasable medium that is nonvolatile in its non-programmed state.

[0014] In one embodiment, the system 100 includes a processor 48, for executing the firmware 200 as well as other application programs and operating system software (not shown). The processor 48 may be any of a variety of processors such as the Pentium® processor, a product of Intel Corporation, of Santa Clara, Calif.

[0015] A persistent storage 42, such as a hard disk drive or compact disk (CD) ROM drive, stores a signed firmware upgrade file 50, according to one embodiment. The signed firmware upgrade file 50 includes data for upgrading portions of the firmware 200. The signed firmware upgrade file 50 originated from a firmware upgrade file that was “signed” by a private key held only by a “trusted source.”

[0016] Designers of ordinary skill in the art of cryptography will recognize such a procedure as an initial measure for authenticating a file. The file to be protected is signed by a private key, where the private key is accessible typically only to a “trusted source.” For example, the private key may be at a manufacturing site, used to sign files to be loaded on processor-based systems before shipment to customers. The customers never see the private key, only the signed file.

[0017] The signed file may then be authenticated by a public key. The availability of the public key is typically more widespread. In the example above, each processor-based system that is shipped to customers may include one or more public keys, which enable the customers to authenticate the signed file residing on the system.

[0018] The signed firmware upgrade file 50 may be downloaded to the persistent storage 42, such as from across a network 60. Accordingly, in one embodiment, the system 100 includes a network interface card 30, for coupling the system 100 to other processor-based systems (not shown) on the network 60.

[0019] In one embodiment, the system 100 further includes a complementary metal oxide semiconductor random access memory (CMOS RAM) 46. CMOS RAM 46 is a low-power semi-volatile storage device. The CMOS RAM 46 is nonvolatile (e.g., contents are retained following a power cycle) as long as a battery or other power source independent of the system power supply is connected to the CMOS RAM 46. The CMOS RAM 46 typically includes configuration information that the firmware 200 accesses during initialization.

[0020] In one embodiment, the CMOS RAM 46 includes an upgrade flag 44. The upgrade flag 44 may be set by a software program whenever an upgrade of the firmware 200 is desired. The firmware 200 checks the upgrade flag 44 during initialization and, when set, initiates a firmware upgrade procedure, according to the protocol described below. Upon completion of the upgrade procedure, the upgrade flag 44 is cleared.

[0021] In one embodiment, the firmware 200 includes a permanent portion 10 and an upgradable portion 20, as shown in FIG. 2. The permanent portion 10 includes that portion of the firmware 200 that is not ever changed. Accordingly, software for minimally powering on the system, shown as a minimal boot portion 12, is part of the permanent portion 10 of the firmware 200. In one embodiment, the permanent portion 10 further includes a signature authentication portion 14 and a write device portion 16.

[0022] In one embodiment, the signature authentication portion 14 includes instructions used to confirm the validity of the firmware upgrade file 50, located in the persistent storage 42 of the system 100. The write device portion 16 includes instructions for reprogramming the upgradable portion 20 of the firmware 200, using the signed firmware upgrade file 50.

[0023] The minimal boot portion 12, signature authentication portion 14 and write device portion 16 of the firmware 200 are relatively permanent because, without them, the system 100 would not be able to power up or perform firmware upgrades. However, in one embodiment, other portions of the firmware 200 may be replaceable. As illustrated in FIG. 2, these replaceable or upgradable portions 20 include hardware initialization portion 22, operating system loader 24, device lock-out portion 26, public key 28 a, and public key 28 b.

[0024] In one embodiment, the hardware initialization portion 22 performs those power-on operations above and beyond what was performed during execution of the minimal boot portion 12 of the firmware 200. In some instances, it may be desirable to upgrade this hardware initialization portion 22. For example, when a new hardware device is to be supported by the system 100, an associated firmware upgrade may be appropriate.

[0025] Another upgradable element is the operating system loader 24. The operating system loader 24 is that portion of the firmware 200 that both loads and executes the operating system. Once the operating system has control of the system 100, e.g., known as runtime operation, the firmware 200 no longer executes. The operating system loader 24 is typically executed at the end of the firmware initialization.

[0026] In one embodiment, the device lock-out portion 26 is also upgradable. Upon execution, the device lock-out portion 26 accesses lock bits 32 that both preclude upgrade of the flash memory 40 and prevent reading of its contents, such as the firmware 200. This prevents access to the firmware 200 by unauthorized users as well as protecting the proprietary software of the manufacturer. Further, unauthorized access to the firmware 200 is prevented by the operating system and application software.

[0027] The upgradable portion 20 of the firmware 200 further includes two public keys 28 a and 28 b. In one embodiment, the public keys 28 are used to access the signed firmware upgrade file 50, located in the persistent storage 42. Two copies of the public key, public keys 28 a and 28 b, are supplied. This allows the public keys 28 themselves to be upgraded. Such an upgrade may be desirable when the private key is changed, for example.

[0028] When no change to the public keys 28 is desired, the public keys 28 are hidden from view by executing the device lock-out portion 26, in one embodiment. Once the flash 40 is locked, the public keys 28 are not readable or writable by any program.

[0029] In some prior art systems, during a firmware upgrade, assurance had to be made that no power interruption would occur during the upgrade itself. If a power interruption did occur, the firmware would essentially be corrupted and, thus, useless. (Often, a firmware program performs a checksum as a first step, prior to any system initialization. An interrupted firmware upgrade would cause the firmware to have an incorrect checksum.) Physical removal of the device from the system and replacement by an uncorrupted device was often the only option for resolving the corrupted firmware problem.

[0030] By having two identical public keys 28 a and 28 b, assurance that a power failure will not occur need not be made during an upgrade of the firmware 200. Instead, an interruption to the firmware upgrade may render one of the public keys 28 a (28 b) useless. Nevertheless, the other public key 28 b (28 a) is available during a subsequent upgrade attempt.

[0031] In one embodiment, during normal operation of the system 100, an application program may download the signed firmware upgrade file 50 into the persistent storage 42. The signed firmware upgrade file 50 may be downloaded to the system 100 from across the network 60, retrieved from a floppy device, or procured by other means. The application program may also set the upgrade flag 44, located in the CMOS RAM 46. The application program may further restart the system 100 such that the firmware 200 begins executing. The firmware 200 checks the upgrade flag 44 to detect if an upgrade of the firmware 200 is appropriate.

[0032] Where the upgrade flag 44 is set, according to one embodiment, the firmware 200 searches the persistent storage 42 for the new firmware upgrade file 50. Once detected, the firmware 200 reads the first copy of the public key 28 a from the firmware 200. If, for any reason, the public key 28 a is invalid, the firmware 200 reads the second copy of the public key 28 b.

[0033] Once a valid public key 28 is found, the firmware 200 uses the public key 28 to verify the validity of the signed firmware upgrade file 50. In one embodiment, the signature authentication software 14 of the firmware 200 is used to verify the signature of the signed firmware upgrade file 50. If the signature is invalid, in one embodiment, the firmware 200 write-locks the flash memory 40 and ignores the upgrade request. The device lock-out program 26 may be executed, locking the flash memory 40 and, thus, preventing the firmware 200 from being upgraded.

[0034] If, however, the signature of the signed firmware upgrade file 50 is valid, the firmware 200 will rewrite, or upgrade, the upgradable portion 20 of the firmware 200. In one embodiment, the write device portion 16 of the firmware 200 performs the upgrade, using the signed firmware upgrade file 50. Once the upgrade of the firmware 200 is complete, the device lock-out routine 26 is executed, which locks the flash memory 40 and thus prevents further modification of the firmware 200.

[0035] In one embodiment, the flash memory 40 is divided into blocks and the upgrade of the firmware 200 is performed block by block. If a power failure occurs while the first public key 28 a is partially written, for example, the valid second public key 28 b, which was not rewritten, is still available for performing upgrades by the firmware 200.

[0036] If the power failure occurs while the second public key 28 b is partially written, according to one embodiment, the first public key 28 a will have already been rewritten. In either instance, a public key 28 is available for authenticating the signed firmware upgrade file 50.

[0037] Once all the upgradable portions 20 of the firmware 200 have been rewritten, the upgrade flag 44 is cleared by the firmware 200. Further, the signed firmware upgrade file 50 is erased from the persistent storage 42. Also following upgrade, according to one embodiment, the firmware 200 causes the system 100 to reboot. Since the upgrade flag 44 is no longer set, the system 100 will boot normally by executing the upgraded system firmware 200 and loading the operating system, as normal.

[0038] These operations are depicted in the flow diagram of FIG. 3, according to one embodiment. Upon receiving power by the system 100, the firmware 200 executes the minimal boot portion 12, part of the permanent portion of the firmware 200 (block 302). The operations performed during the minimal boot portion 12 may vary from system to system. In one embodiment, minimal boot includes initializing at least a portion of memory, initializing the video subsystem, and enabling a keyboard or other input device of the system 100.

[0039] In one embodiment following execution of the minimal boot portion 12, the firmware 200 reads the upgrade flag 44, located in the CMOS RAM 46 (diamond 304). Where the upgrade flag has not been set (the NO prong), no firmware upgrade is performed. Instead, the firmware 200 completes system component initialization that was not performed during the minimal boot sequence (block 306).

[0040] Next, the device lock-out portion 26 of the firmware 200 is executed (block 308). In one embodiment, the device lock-out portion 26 sets the lock bits 32 such that the flash memory 40 is both not upgradable (write lock) and not viewable (read lock). The write lock prevents the firmware 200 from being upgraded, whether surreptitiously or unintentionally.

[0041] By also read-locking the firmware 200, the ability to decode the instructions contained therein is not possible. More importantly, in one embodiment, the public keys 28 may not be decoded. Where the firmware 200 includes proprietary software or software that is a trade secret, the read-lock feature may be preferred.

[0042] Once the firmware is secure, the firmware 200 loads the operating system loader (block 310), for execution. Accordingly, the operating system is booted (block 312).

[0043] Where, instead, the upgrade flag 44 is set, (the YES prong of diamond 304), the firmware 200 checks to see whether the signed firmware upgrade file 50 is present in the persistent storage 42 (diamond 314). If not, (the NO prong) no upgrade of the firmware 200 is possible. Instead, according to one embodiment, the upgrade flag 44 is cleared (block 324). When the system 100 is subsequently rebooted, an upgrade of the firmware 200 is not attempted because the upgrade flag 44 has been cleared.

[0044] Where the signed firmware upgrade file 50 is available (the YES prong of diamond 314), the firmware 200 retrieves the first public key 28 a, from the firmware 200. The validity of the public key 28 a is confirmed (diamond 316). The public key 28 a may be validated in a number of ways known to those of skill in the art, including, but not limited to performing a checksum of the public key. If the public key 28 a is deemed not valid (the NO prong), the second public key 28 b is retrieved (block 318).

[0045] Where either the second public key 28 b is retrieved or the first public key 28 a is deemed valid (the YES prong of diamond 316), the signed firmware upgrade file 50 is authenticated using the public key 28 (diamond 320). Where the signed firmware upgrade 50 is not valid (the NO prong), no upgrade of the firmware 200 is performed. Instead, once again, the upgrade flag 44 is cleared (block 324) and the signed firmware upgrade file 50 is erased from the persistent storage 42 (block 326). As when no firmware upgrade file was present (diamond 314), this prevents the firmware 200 from attempting an upgrade on a subsequent boot of the system 100.

[0046] If, instead, the signed firmware upgrade file 50 is deemed valid by the signature authentication software 14, the upgradable portion 20 of the firmware 200 is rewritten at this time (block 322). The rewrite operation performed on the upgradable portion 20 of the firmware 200 is described in more detail in the flow diagram of FIG. 4, below.

[0047] Once the firmware upgrade has completed (or has been deemed not upgradable), the upgrade flag 44 is reset or cleared (block 324). Likewise, the signed firmware upgrade file 50 is erased from the persistent storage 42 (block 326). Thus, the replacement of the upgradable portion 20 of the firmware 200 is complete, according to one embodiment. Following the firmware upgrade, the system 100 is rebooted (block 328).

[0048] According to one embodiment, the rewrite of the upgradable portion 20 of the firmware 200 may be performed by separating the firmware 200 into functional blocks, such as depicted in FIG. 2, above. In one embodiment, the upgrade operation is then performed by identifying a first upgradable block, upgrading the block, then proceeding to a subsequent upgradable block.

[0049] For example, the upgradable portion 20 of the firmware 200 may include a first block 40 including the hardware initialization portion 22, a second block including the operating system loader 24, a third block including the device lockout portion 26, a fourth block including the first public key 28 a, and, finally, a fifth block including the second public key 28 b.

[0050] In a second embodiment, the upgradable portion 20 of the firmware 200 is divided into blocks of equal sizes, each of which may be upgraded in turn. So, for example, the hardware initialization portion 22 may be divided into three blocks of equal sizes, each of which is upgraded in turn. The operating system loader 24 may comprise but a single block, and so on.

[0051] In FIG. 4, a variable, i, denoting a block of the upgradable portion 20 of the firmware 200, is reset (block 402), such that the first (or 0^(th)) block of the upgradable portion 20 is accessed. The i^(th) block is then erased (block 404), using the write device software 16, located in the permanent portion 10 of the firmware 200. The write device software 16 receives data from the signed firmware upgrade file 50 and writes the data to the i^(th) block of the flash memory 40 (block 406). Where all the blocks of the upgradable portion 20 have been written (diamond 408), the process is complete. Where additional blocks are to be written (the NO prong), the write device software 16 points to another block of the upgradable portion 20 (block 410). The subsequent block is then erased (block 404) so that new data may be written to the block (block 406). These operations are repeated until all upgradable blocks have been written.

[0052] While the present invention has been described with respect to a limited number of embodiments, those skilled in the art will appreciate numerous modifications and variations therefrom. It is intended that the appended claims cover all such modifications and variations as fall within the true spirit and scope of this present invention. 

What is claimed is:
 1. A method comprising: identifying a firmware upgrade request by a firmware program; retrieving a file signed with a private key; validating the file with a public key; upgrading a portion of the firmware program by the firmware program; and locking a device storing the firmware program such that a second portion of the firmware program is not readable.
 2. The method of claim 1, further comprising: validating the public key; and retrieving a second public key from the firmware program if the public key is not valid.
 3. The method of claim 1, identifying a firmware upgrade request by a firmware program further comprising: reading a flag, wherein the flag is located in a non-volatile medium; and determining that the flag is set.
 4. The method of claim 3, further comprising: deleting the file; and clearing the flag.
 5. The method of claim 1, further comprising: determining that the file is not authentic; and locking the device.
 6. The method of claim 1, further comprising: locking the device after upgrading a portion of the firmware program by the firmware program.
 7. The method of claim 1, wherein the second portion of the firmware program is a public key.
 8. A method comprising: identifying an upgrade request for a firmware program of a system; upgrading a first public key of the firmware program; receiving an interruption of power to the system; and using a second public key to subsequently upgrade the firmware program.
 9. The method of claim 8, further comprising: retrieving a file signed by a private key from the system; and authenticating the file with the second public key.
 10. The method of claim 9, further comprising: locking the device such that a portion of the firmware program is not readable.
 11. The method of claim 10, locking the device such that a portion of the firmware program is not readable further comprising locking the device such that the public keys are not readable.
 12. The method of claim 9, further comprising: locking the device such that the public keys are not writable.
 13. A system comprising: a file signed by a private key; a device for storing a program, wherein the device may lock access to the program; and a firmware program stored in the device, which, upon execution: determines that an upgrade flag is set; retrieves the file; validates the file using a public key; upgrades a portion of the firmware program; and locks the device such that the a portion of the firmware program is not readable.
 14. The system of claim 13, wherein the portion is the public key.
 15. The system of claim 13, wherein the firmware program further clears the upgrade flag.
 16. The system of claim 13, further comprising: a persistent storage, wherein the file is located in the persistent storage.
 17. The system of claim 13, further comprising: a network interface for connecting the system to a network, wherein the file is retrieved from the network.
 18. The system of claim 13, the firmware program comprises a second portion further comprising: a minimal boot portion; a signature authentication portion; and a write device portion.
 19. The system of claim 13, wherein the portion of the firmware program further comprises: a hardware initialization portion; an operating system loader portion; and a device lock-out portion.
 20. The system of claim 18, wherein the portion of the firmware program further comprises: the public key; and a backup public key.
 21. The system of claim 13, wherein the device is a flash memory.
 19. A system comprising: a file signed by a private key; and a firmware program comprising a permanent portion and an upgradable portion, wherein the upgradable portion includes a first public key and a second public key, the firmware program further: identifies a request to upgrade the firmware program; experiences an interruption in execution during an upgrade of the first public key; and upgrades the firmware program using the second public key once the interruption in execution is complete.
 22. The system of claim 21, further comprising an upgrade flag with which the firmware program identifies the request to upgrade the firmware program.
 23. The system of claim 22, wherein the interruption in execution is due to a power loss to the system.
 24. The system of claim 22 further comprising a device for storing the firmware program wherein the device is locked such that the public keys are not writable after the firmware program is upgraded.
 25. The system of claim 22, further comprising a device for storing the firmware program wherein the device is locked such that the public keys are not readable after the firmware program is upgraded.
 26. An article comprising a medium storing instructions for enabling a processor-based system to: identify a firmware upgrade request by a firmware program; retrieve a file signed with a private key; validate the file with a public key; upgrade a portion of the firmware program by the firmware program; and lock a device storing the firmware program such that the public key is not readable.
 27. The article of claim 26, further storing instructions that enable the processor-based system to: validate the public key; and retrieve a second public key from the firmware program if the public key is not valid.
 28. The article of claim 27, further storing instructions that enable the processor-based system to: determine that the file is not authentic; and lock the device.
 29. An article comprising a medium storing instructions for enabling a processor-based system to: identify an upgrade request for a firmware program of a system; upgrade a first public key of the firmware program; receive an interruption of power to the system; use a second public key to subsequently upgrade the firmware program.
 30. The article of claim 29, further storing instructions that enable the processor-based system to: retrieve a file signed by a private key from the system; and authenticate the file with the second public key. 